<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>C语言错题集 | Jixer的小屋</title><meta name="author" content="Jixer"><meta name="copyright" content="Jixer"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="总结 以数字0开头（不是字母o）的为八进制，其后只能出现数字0-7  以0x开头的为16进制，其后只能出现0-9或者abcdef（大写也可）  字符串常量：1.普通字符 2.转义字符 3. \ + ascall码 （\0dd（八进制）,\xhh（十六进制））  \+字母：控制字符； \+13个八进制数：ascll该八进制数的字符 ；\x+12个十六进制数：ascll为该十六进制数的字符  实型常数">
<meta property="og:type" content="article">
<meta property="og:title" content="C语言错题集">
<meta property="og:url" content="http://www.lijunxi.site/posts/3014530432/index.html">
<meta property="og:site_name" content="Jixer的小屋">
<meta property="og:description" content="总结 以数字0开头（不是字母o）的为八进制，其后只能出现数字0-7  以0x开头的为16进制，其后只能出现0-9或者abcdef（大写也可）  字符串常量：1.普通字符 2.转义字符 3. \ + ascall码 （\0dd（八进制）,\xhh（十六进制））  \+字母：控制字符； \+13个八进制数：ascll该八进制数的字符 ；\x+12个十六进制数：ascll为该十六进制数的字符  实型常数">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://q1.qlogo.cn/g?b=qq&nk=2770063826&s=640">
<meta property="article:published_time" content="2024-01-17T05:44:48.000Z">
<meta property="article:modified_time" content="2024-05-07T03:10:23.197Z">
<meta property="article:author" content="Jixer">
<meta property="article:tag" content="C语言">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://q1.qlogo.cn/g?b=qq&nk=2770063826&s=640"><link rel="shortcut icon" href="/img/logo/favicon.ico"><link rel="canonical" href="http://www.lijunxi.site/posts/3014530432/index.html"><link rel="preconnect"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css?v=4.13.0"><link rel="stylesheet" href="/pluginsSrc/@fortawesome/fontawesome-free/css/all.min.css?v=6.5.1"><link rel="stylesheet" href="/pluginsSrc/@fancyapps/ui/dist/fancybox/fancybox.css?v=5.0.33" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":true,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  infinitegrid: {
    js: '/pluginsSrc/@egjs/infinitegrid/dist/infinitegrid.min.js?v=4.11.1',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'C语言错题集',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2024-05-07 11:10:23'
}</script><script>(win=>{
      win.saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
    
      win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        script.onerror = reject
        script.onload = script.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          script.onload = script.onreadystatechange = null
          resolve()
        }

        Object.keys(attr).forEach(key => {
          script.setAttribute(key, attr[key])
        })

        document.head.appendChild(script)
      })
    
      win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onerror = reject
        link.onload = link.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          link.onload = link.onreadystatechange = null
          resolve()
        }
        document.head.appendChild(link)
      })
    
      win.activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
        if (t === 'dark') activateDarkMode()
        else if (t === 'light') activateLightMode()
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })(window)</script><link rel="stylesheet" href="/css/custom-all-min.css"><link rel="stylesheet" href="/css/custom-fancybox-min.css"><link rel="stylesheet" href="/css/custom-share-min.css"><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>(()=>{
  const $loadingBox = document.getElementById('loading-box')
  const $body = document.body
  const preloader = {
    endLoading: () => {
      $body.style.overflow = ''
      $loadingBox.classList.add('loaded')
    },
    initLoading: () => {
      $body.style.overflow = 'hidden'
      $loadingBox.classList.remove('loaded')
    }
  }

  preloader.initLoading()
  window.addEventListener('load',() => { preloader.endLoading() })

  if (false) {
    document.addEventListener('pjax:send', () => { preloader.initLoading() })
    document.addEventListener('pjax:complete', () => { preloader.endLoading() })
  }
})()</script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="" data-original="https://q1.qlogo.cn/g?b=qq&amp;nk=2770063826&amp;s=640" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">52</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">19</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">7</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-graduation-cap"></i><span> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-archive"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog-info"><a href="/" title="Jixer的小屋"><span class="site-name">Jixer的小屋</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-graduation-cap"></i><span> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-archive"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">C语言错题集</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-01-17T05:44:48.000Z" title="发表于 2024-01-17 13:44:48">2024-01-17</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-05-07T03:10:23.197Z" title="更新于 2024-05-07 11:10:23">2024-05-07</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%A4%8D%E4%B9%A0%E8%B5%84%E6%96%99/">复习资料</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">8.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>33分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="C语言错题集"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h3><ul>
<li><p>以数字0开头（不是字母o）的为八进制，其后只能出现数字0-7</p>
</li>
<li><p>以0x开头的为16进制，其后只能出现0-9或者abcdef（大写也可）</p>
</li>
<li><p>字符串常量：1.普通字符 2.转义字符 3. \ + ascall码 （\0dd（八进制）,\xhh（十六进制））</p>
</li>
<li><p>\+字母：控制字符； \+1<del>3个八进制数：ascll该八进制数的字符 ；\x+1</del>2个十六进制数：ascll为该十六进制数的字符</p>
</li>
<li><p>实型常数：2E0 （E前面必须有数:+5,-5,5,05,5.都行；E后面必须是整数(正负0都行):+5,-5,5）</p>
</li>
<li><p>char a[] &#x3D; “123” 和 char a[] &#x3D; {‘a’,’b’,’c’} sizeof不同，strlen相同</p>
</li>
<li><p>EOF是作为文本文件的结束标志，其值为-1</p>
</li>
<li><p>反斜杠后的16进制数只可以由小写字母x开头，不允许大写字母x，也不允许用ox开头</p>
</li>
<li><p>auto:自动变量,会自动分配空间,但不是自动赋值0；static:函数结束存储单元不会释放</p>
</li>
<li><p>static:静态局部变量 ； register:寄存器变量,强制保留在CPU,该变量不能用&amp;</p>
</li>
<li><p>strcpy(1,2)和strcat(1,2)需要保证1足够大能容纳2</p>
</li>
<li><p>空指针不能改变其值</p>
</li>
<li><p>pi&#x3D;pj&#x3D;(short *)malloc(2); pi和pj同时指向同一空间</p>
</li>
<li><p>printf输出的数据都是隐含右对齐</p>
</li>
<li><p>printf输出的数据实际精度是由格式控制的小数的领宽来完全决定的</p>
</li>
<li><p>C语言虽然不限制标识符的长度,但是它受到不同编译器的限制,同时也受到操作系统的限制</p>
</li>
<li><p>switch( xx ); 必须要有() 和 ;</p>
</li>
<li><p>gets()能接受空格,scanf()不能识别空格，制表符，回车符</p>
</li>
<li><p>实参和形参在不同的存储单元</p>
</li>
<li><p>结构体能相互赋值（每个成员都变）,数组不能</p>
</li>
<li><p>c语言算法可以没有输入但你必须要有输出</p>
</li>
<li><p>全局变量的作用域：定义变量开始到本源文件结束（由具体位置和extern说明来决定）</p>
</li>
<li><p>函数不写类型名默认为int</p>
</li>
<li><p>exit(0) 是退出整个进程，不论在哪里调用，都会退出当前进程</p>
</li>
<li><p>typedef是声明新的类型名代替已有的类型名，并不是添加新的类型</p>
</li>
<li><p>构成C程序的基本单位是函数</p>
</li>
</ul>
<h3 id="位运算"><a href="#位运算" class="headerlink" title="位运算"></a>位运算</h3><p>~：按位取反</p>
<p>&amp;：有0则0，无0则1</p>
<p>|：有1则1，无1则0</p>
<p>^：相同为0，相异为1</p>
<p>&lt;&lt;：左移x位，原数乘以2的x方</p>
<p>&gt;&gt;：右移x位，原数除以2的x方</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">变量a中的数据用二进制表示的形式是01011101，变量b中的数据用二进制表示的形式是111100。若要求将a的高4位取反，低4位不变，所要执行的运算是</span><br><span class="line">A.a^b</span><br><span class="line">B.a/b</span><br><span class="line">C.a&amp;b</span><br><span class="line">D.a&lt;&lt;4</span><br><span class="line">我的答案：D 正确答案：A</span><br><span class="line"></span><br><span class="line">//  ^：相同为0，相异为1</span><br><span class="line">01011101</span><br><span class="line">11110000</span><br><span class="line">10101101</span><br></pre></td></tr></table></figure>

<h3 id="指针"><a href="#指针" class="headerlink" title="指针"></a>指针</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;string.h&gt;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">char str[][10]= &#123; &quot;One&quot; , &quot;Three&quot; , &quot;Five&quot;&#125;, *p = str[0];</span><br><span class="line">printf( &quot;%s,&quot; , p+10 );</span><br><span class="line">printf( &quot;%d\n&quot; ,strlen(p+=10) );</span><br><span class="line">&#125;</span><br><span class="line">执行后的输出结果是______。</span><br><span class="line">&#125;    //p+10为数组第二行首地址</span><br><span class="line">A. 出错   </span><br><span class="line">B. Three,5</span><br><span class="line">C. Three,4</span><br><span class="line">D. Five,5</span><br><span class="line">我的答案: C正确答案: B</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int *f(int *s, int *t)</span><br><span class="line">&#123;</span><br><span class="line">int *k;</span><br><span class="line">if (*s&lt;*t) &#123;</span><br><span class="line">k = s;</span><br><span class="line">s=t;</span><br><span class="line">t=k;</span><br><span class="line">&#125;</span><br><span class="line">return s;</span><br><span class="line">&#125;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int i=3, j=5, *p=&amp;i, *q=&amp;j, *r;</span><br><span class="line">r=f(p,q);</span><br><span class="line">printf(&quot;%d,%d,%d,%d,%d\n&quot;, i, j, *p, *q, *r);</span><br><span class="line">&#125;</span><br><span class="line">则程序的输出结果是______。</span><br><span class="line">A. 3,5,3,5,5</span><br><span class="line">B. 3,5,5,3,5</span><br><span class="line">C. 5,3,5,3,5</span><br><span class="line">D. 5,3,3,5,5</span><br><span class="line">我的答案: B正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">void fun( int *p, int *q )</span><br><span class="line">&#123;</span><br><span class="line">int t;</span><br><span class="line">t = *p;   //*t:0</span><br><span class="line">*p = *q;   //*p:9</span><br><span class="line">*q=t;   //*q:0</span><br><span class="line">*q = *p;   //*q:9</span><br><span class="line">&#125;   //*p,*q:9,9</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int a=0, b=9;</span><br><span class="line">fun ( &amp;a, &amp;b );</span><br><span class="line">printf( &quot;%d %d\n&quot; , a,b );</span><br><span class="line">&#125;</span><br><span class="line">程序的输出结果是______。</span><br><span class="line">A. 0 0</span><br><span class="line">B. 9 9</span><br><span class="line">C. 9 0</span><br><span class="line">D. 0 9</span><br><span class="line">我的答案: C正确答案: B</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int k=5;</span><br><span class="line">void f(int *s)</span><br><span class="line">&#123;</span><br><span class="line">s=&amp;k;</span><br><span class="line">&#125;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int m=3,*p=&amp;m;</span><br><span class="line">f(p);</span><br><span class="line">printf(&quot;%d,%d\n&quot;, m, *p);</span><br><span class="line">&#125;</span><br><span class="line">程序的运行结果是______。</span><br><span class="line">A. 3,3</span><br><span class="line">B. 5,5</span><br><span class="line">C. 3,5</span><br><span class="line">D. 5,3</span><br><span class="line">我的答案: C正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int change(int* data)</span><br><span class="line">&#123;</span><br><span class="line">return (*data)++;</span><br><span class="line">&#125;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int data = 123;</span><br><span class="line">change(&amp;data);</span><br><span class="line">printf(&quot;%d,&quot;, data);</span><br><span class="line">data = change(&amp;data);</span><br><span class="line">printf(&quot;%d,&quot;, data);</span><br><span class="line">printf(&quot;\n&quot;);</span><br><span class="line">&#125;</span><br><span class="line">程序运行后的输出结果是______。</span><br><span class="line">A. 123,123,</span><br><span class="line">B. 123,124,</span><br><span class="line">C. 124,123,</span><br><span class="line">D. 124,124,</span><br><span class="line">我的答案: B正确答案: D</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int *f(int *s,int *t)</span><br><span class="line">&#123;</span><br><span class="line">if (*s &lt; *t) s=t; //指针指向改变,目标元素值没变</span><br><span class="line">return s;</span><br><span class="line">&#125;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int i=3, j=5, *p=&amp;i, *q=&amp;j, *r;</span><br><span class="line">r=f(p,q);</span><br><span class="line">printf(&quot;%d,%d,%d,%d,%d\n&quot;, i, j, *p, *q, *r);</span><br><span class="line">&#125;</span><br><span class="line">程序的运行结果是______。</span><br><span class="line">A. 3,5,3,5,5</span><br><span class="line">B. 3,5,5,5,5</span><br><span class="line">C. 5,3,3,3,5</span><br><span class="line">D. 5,5,5,5,5</span><br><span class="line">我的答案: B正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">有以下程序#include&lt;stdio.h&gt;</span><br><span class="line">void fun(int *a,int *b)</span><br><span class="line">&#123;int *c;</span><br><span class="line">c=a;a=b;b=c;</span><br><span class="line">&#125;</span><br><span class="line">main()</span><br><span class="line">&#123;int x=3,y=5,*p=&amp;x,*q=&amp;y;</span><br><span class="line">fun(p,q);</span><br><span class="line">printf(&quot;%d,%d,&quot;,*p,*q);</span><br><span class="line">fun(&amp;x,&amp;y);</span><br><span class="line">printf(&quot;%d,%d&quot;,*p,*q);&#125;</span><br><span class="line">程序运行后的输出结果是</span><br><span class="line">A.3,5,5,3</span><br><span class="line">B.3,5,3,5</span><br><span class="line">C.5,3,3,5</span><br><span class="line">D.5,3,5,3</span><br><span class="line"></span><br><span class="line">我的答案：D  正确答案：B</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">此题改一下后就不一样</span><br><span class="line">void fun(int *a,int *b)</span><br><span class="line">&#123;int c;</span><br><span class="line">c=＊a;＊a=＊b;＊b=c;</span><br><span class="line">&#125;</span><br><span class="line">main()</span><br><span class="line">&#123;int x=3,y=5,*p=&amp;x,*q=&amp;y;</span><br><span class="line">fun(p,q);</span><br><span class="line">printf(&quot;%d,%d,&quot;,*p,*q);</span><br><span class="line">fun(&amp;x,&amp;y);</span><br><span class="line">printf(&quot;%d,%d&quot;,*p,*q);</span><br><span class="line">&#125;</span><br><span class="line">答案：5，3，3，5</span><br><span class="line"></span><br><span class="line">//个人理解：函数会单独开一个空间指向该地址，地址变化也只在该开辟空间的地址上改变，并不会影响到原地址，但是如果是*地址的话就会改变，因为*地址的话会直接根据开辟的空间地址找到main函数中的地址再找到目标元素，从而实现改变。</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">若有一些定义和语句</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int a=4,b=3,*p,*q,*w;</span><br><span class="line">p=&amp;a;q=&amp;b;w=q;q=NULL;</span><br><span class="line">则以下选项中错误的语句是_____。</span><br><span class="line">A.*q=0;</span><br><span class="line">B.w=p;</span><br><span class="line">C.*p=va;</span><br><span class="line">D.*p=*w;</span><br><span class="line">我的答案：C  标准答案：A</span><br><span class="line"></span><br><span class="line">//由于指针变量q赋值为NULL，即空地址，如果给空地址所指向的存储空间赋值的话，系统会出错，提示为:Null point assignment!</span><br></pre></td></tr></table></figure>

<h3 id="数组"><a href="#数组" class="headerlink" title="数组"></a>数组</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">(单选题)已有定义:char a[]=&quot;xyz&quot;,b[]=&#123;&#x27;x&#x27;,&#x27;y&#x27;,&#x27;z&#x27;&#125;;,以下叙述中正确的是______。</span><br><span class="line">A. 数组a和</span><br><span class="line">B. 的长度相同</span><br><span class="line">B、 a数组长度小于b数组长度</span><br><span class="line">C. a数组长度大于b数组长度</span><br><span class="line">D. 上述说法都不对</span><br><span class="line">我的答案: D正确答案: C</span><br><span class="line"></span><br><span class="line">//数组 a 的长度为 4，其内容为 &#x27;x&#x27;、&#x27;y&#x27;、&#x27;z&#x27;、&#x27;\0&#x27;，其中 &#x27;\0&#x27; 是字符串结束标志。</span><br><span class="line">//数组 b 的长度为 3，内容为 &#x27;x&#x27;、&#x27;y&#x27;、&#x27;z&#x27;。</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(单选题)以下叙述正确的是______。</span><br><span class="line">A. char c1, *c2, **c3, c4[2]; 是C语言的合法语句</span><br><span class="line">B. 不能在数组说明符的一对方括号中使用表达式</span><br><span class="line">C. 数组下标的最小值可以是负值</span><br><span class="line">D. 若有数组定义 int array[5]; 则语句 printf(&quot;%d&quot;, array[1.23]);是合法的</span><br><span class="line">我的答案: C正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">(单选题)设有如下程序段</span><br><span class="line">int a[8] = &#123;0&#125;;</span><br><span class="line">int b[] = &#123;0&#125;;</span><br><span class="line">char c[2] = &#123;&quot;A&quot;, &quot;B&quot;&#125;;</span><br><span class="line">char d = &quot;AB&quot;;</span><br><span class="line">以下叙述正确的是______。</span><br><span class="line">A.只有变量c的定义是合法的</span><br><span class="line">B.所有变量的定义都是完全合法的</span><br><span class="line">C.只有变量a,b,c的定义是完全合法的</span><br><span class="line">D.只有变量a, b的定义是完全合法的</span><br><span class="line">我的答案: B正确答案: D</span><br><span class="line"></span><br><span class="line">//这题出的时候有问题，我改了下</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(单选题)以下能正确定义一维数组的选项是______。</span><br><span class="line">A. int a[5]=&#123;0,1,2,3,4,5&#125;;</span><br><span class="line">B. char a[]=&#123;0,1,2,3,4,5&#125;;</span><br><span class="line">C. char a=&#123;&#x27;A&#x27;,&#x27;B&#x27;,&#x27;C&#x27;&#125;;</span><br><span class="line">D. int a[5]=&quot;0123&quot;;</span><br><span class="line">我的答案: A正确答案: B</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(单选题)假定int类型变量占用两个字节,若有定义:int x[10]=&#123;0,2,4&#125;;,则数组x在内存中所占字节数是______。</span><br><span class="line">A. 3</span><br><span class="line">B. 6</span><br><span class="line">C. 10</span><br><span class="line">D. 20  //定义多少算多少</span><br><span class="line">我的答案: B正确答案: D</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(单选题)以下叙述中错误的是______。</span><br><span class="line">A. 对于double类型数组,不可以直接用数组名对数组进行整体输入或输出</span><br><span class="line">B. 数组名代表的是数组所占存储区的首地址,其值不可改变</span><br><span class="line">C. 当程序执行中,数组元素的下标超出所定义的下标范围时,系统将给出&quot;下标越界&quot;的出错信息</span><br><span class="line">D. 可以通过赋初值的方式确定数组元素的个数</span><br><span class="line">我的答案: A正确答案: C</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">(单选题)若有定义:a[]=&#123;1,2,3,4,5,6,7,8,9,10&#125;;,则a[a[5]-a[7]/a[1]]的值是______。</span><br><span class="line">A. 4</span><br><span class="line">B. 3</span><br><span class="line">C. 2</span><br><span class="line">D. 10</span><br><span class="line">我的答案: D正确答案: B</span><br><span class="line"></span><br><span class="line">//a[6-8/2] = 3</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(单选题)若有以下定义:int t[3][2];能正确表示t数组元素地址的表达式是______。</span><br><span class="line">A. t[3][2] //元素</span><br><span class="line">B. t[3] //越界</span><br><span class="line">C. t[1]</span><br><span class="line">D. *t[2] //值</span><br><span class="line">我的答案: D正确答案: C</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">(单选题)函数FindMin的形参a所指数组中只存放正整数,函数的功能是查找数组中最小值,并作为函数值返回</span><br><span class="line">#define MAX 2147483647</span><br><span class="line">int FindMin(int a[],int n)</span><br><span class="line">&#123;</span><br><span class="line">int i, min;</span><br><span class="line">min=______;</span><br><span class="line">for(i=n-1; i&gt;=0; i--)</span><br><span class="line">if(min&gt;a[i])</span><br><span class="line">min=a[i];</span><br><span class="line">return min;</span><br><span class="line">&#125;</span><br><span class="line">程序中下划线处是给变量min赋初值,以下选项中错误的是______。</span><br><span class="line">A. 0</span><br><span class="line">B. MAX</span><br><span class="line">C. a[0]</span><br><span class="line">D. a[n-1]</span><br><span class="line">我的答案: B正确答案: A</span><br><span class="line"></span><br><span class="line">//题看错了选了就跑0.0</span><br></pre></td></tr></table></figure>

<h3 id="前五章基础题"><a href="#前五章基础题" class="headerlink" title="前五章基础题"></a>前五章基础题</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int main()</span><br><span class="line">&#123;</span><br><span class="line">int i,a;</span><br><span class="line">i = (a=(a=(a=2*3,a*5),a+6),a+7);</span><br><span class="line">printf(&quot;%d %d&quot;,i,a);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">答案：43 36</span><br><span class="line"></span><br><span class="line">//1. a = 3*2 =6  </span><br><span class="line">//2. a*5 = 30</span><br><span class="line">//3. a = 30</span><br><span class="line">//4. a = a+6 = 36</span><br><span class="line">//5. a = 36</span><br><span class="line">//6. a+7 = 43</span><br><span class="line">//7. i = 43</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int main()</span><br><span class="line">&#123;</span><br><span class="line">int i,a;</span><br><span class="line">i = ((a=2*3,a*5),a+6),a+7;</span><br><span class="line">printf(&quot;%d %d&quot;,i,a);</span><br><span class="line">&#125;</span><br><span class="line">答案：12 6</span><br><span class="line"></span><br><span class="line">//与上题类似,逗号表达式从左到右依次来计算</span><br><span class="line">//注意等号左边是否有赋值语句</span><br><span class="line">//1. a = 3*2 =6  </span><br><span class="line">//2. a*5 = 30</span><br><span class="line">//3. a+6 = 12</span><br><span class="line">//4. i = 12</span><br><span class="line">//5. a+7 = 13</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">设有以下程序段,执行后的输出结果是_____。</span><br><span class="line">int x=100,y=200;</span><br><span class="line">printf(&quot;%d&quot;,(x,y));</span><br><span class="line">A. 100</span><br><span class="line">B. 200</span><br><span class="line">C. 100,200</span><br><span class="line">D. 编译出错</span><br><span class="line">我的答案: C正确答案: B</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">执行语句printf(&quot;The program&#x27;s name is c:\\tools\book.txt&quot;);后的输出是______。</span><br><span class="line">A. The program&#x27;s name is c:tools</span><br><span class="line">B. The program&#x27;s name is</span><br><span class="line">C. \tools\book.txt</span><br><span class="line"></span><br><span class="line">C、 The program&#x27;s name is c:\\tool</span><br><span class="line">D. The program&#x27;s name is c:\toolook.txt</span><br><span class="line">我的答案: D正确答案: D</span><br><span class="line"></span><br><span class="line">//  \b为退格符:一格</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">int a = 1;</span><br><span class="line">printf(&quot;%d %d %d&quot;,a,a++,++a);   //3 2 3</span><br><span class="line"></span><br><span class="line">//printf从右往左入栈，但是输出的顺序为：x或++x只改变x的值最后才输出，x++确定此位置的输出并立刻输出。指针：最后的*x和*++x并不是此时的*x的值，不会发生改变；其他：x最后计算完后，x和++x位置的值都是此时x的值</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">设a,b,c,d均是int类型变量,为了使以下程序段的输出为:1234+123+12+1,正确的输入形式应当是______。</span><br><span class="line">scanf(&quot;%4d+%3d+%2d+%1d&quot;,&amp;a,&amp;b,&amp;c,&amp;d);</span><br><span class="line">printf(&quot;%4d+%3d+%2d+%1d&quot;,a,b,c,d);</span><br><span class="line">A. 1234123121&lt;回车&gt;</span><br><span class="line">B. 1234123412341234&lt;回车&gt;</span><br><span class="line">C. 1234+1234+1234+1234&lt;回车&gt;</span><br><span class="line">D. 1234+123+12+1&lt;回车&gt;</span><br><span class="line">我的答案: A正确答案: D</span><br><span class="line"></span><br><span class="line">//这题傻逼了0.0</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">main()</span><br><span class="line">&#123; int al,a2; char cl,c2;</span><br><span class="line">scanf(“%d%c%d%c”,&amp;a1,&amp;cl,&amp;a2,&amp;c2);</span><br><span class="line">printf(“%d, %c,%d, %c”,a1,c1,a2, c2);</span><br><span class="line">&#125;</span><br><span class="line">若想通过键盘输入,使得a1的值为12,a2的值为34,c1的值为字符a,c2的值为字符b,程序输出的结果是:12,a,34,b 则正确的输入格式是(以下~代表空格,&lt;CR&gt;代表回车)</span><br><span class="line">A. 12a34b</span><br><span class="line">B. 12~a~34~b</span><br><span class="line">C. 12,a,34,b</span><br><span class="line">D. 12~a34~b</span><br><span class="line">我的答案: C正确答案: A</span><br><span class="line"></span><br><span class="line">//有煞笔了0.0</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">根据定义和数据的输入方式,输入语句的正确形式为______。</span><br><span class="line">已有定义:float f1,f2;</span><br><span class="line">数据的输入方式:4.52&lt;CR&gt;</span><br><span class="line">3.5&lt;CR&gt;</span><br><span class="line">A. scanf(&quot;%f,%f&quot;,&amp;f1,&amp;f2);</span><br><span class="line">B. scanf(&quot;%f%f&quot;,&amp;f1,&amp;f2);</span><br><span class="line">C. scanf(&quot;%3.2f%2.1f&quot;,&amp;f1,&amp;f2);</span><br><span class="line">D. scanf(&quot;%3.2f,%2.1f&quot;,&amp;f1,&amp;f2);</span><br><span class="line">我的答案: C正确答案: B</span><br><span class="line"></span><br><span class="line">//  &lt;CR&gt;：回车键</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">已知int a,b;用语句scanf(&quot;%d%d&quot;,&amp;a,&amp;b);输入a,b的值,不能作为输入数据分隔符的是______。</span><br><span class="line">A. ,</span><br><span class="line">B. 空格</span><br><span class="line">C. 回车</span><br><span class="line">D. [tab]</span><br><span class="line">我的答案: D正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">若有以下类型说明语句:char a; int b;float c; double d; 则表达式a*b-2*d+c的结果类型为_______。</span><br><span class="line">A. float</span><br><span class="line">B. char</span><br><span class="line">C. int</span><br><span class="line">D. double</span><br><span class="line">我的答案: A正确答案: D</span><br><span class="line"></span><br><span class="line">//隐式类型转换</span><br><span class="line">1、为防止精度损失，如果必要的话，类型总是被提升为较宽的类型。</span><br><span class="line">2、所有含有小于整形的有序类型的算术表达式在计算之前其类型都会被转换成整形。</span><br><span class="line">double + float = double</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">将字符g赋给字符变量c,正确的表达式是_______。</span><br><span class="line">A. c=&quot;g&quot;</span><br><span class="line">B. c=101</span><br><span class="line">C. c=&#x27;\147&#x27;</span><br><span class="line">D. c=&#x27;0147&#x27;</span><br><span class="line">我的答案: B正确答案: C</span><br><span class="line"></span><br><span class="line">//a的ascall值97</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">若有变量说明:int a=0,b=0,c=0;,以下符合C语言语法的赋值表达式是_______。</span><br><span class="line">A. a=9+b+c=a+9</span><br><span class="line">B. a=9+b;</span><br><span class="line">C. a=(9+b,b++)</span><br><span class="line">D. a=9+b++=a+7</span><br><span class="line">我的答案: B正确答案: C</span><br><span class="line"></span><br><span class="line">//a，d表达式不能是左值，9+b+c和9+b++是一个表达式不能在左边</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">下面四个选项中,均是C语言关键字的选项是_______。</span><br><span class="line">A. auto enum include</span><br><span class="line">B. switch typedef continue</span><br><span class="line">C. signed union scanf</span><br><span class="line">D. if struct type</span><br><span class="line">我的答案: C正确答案: B</span><br><span class="line"></span><br><span class="line">//关键字：void signed unsigned　short　long　int　float　double　char　enum　struct　union　typedef const　 volatile auto　static　extern　register sizeof　goto　return　break　continue　if　else　switch　case　default　do　while　for</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">下列四组选项中,均是不合法的用户标识符的选项是_______。</span><br><span class="line">A. A P_0 do</span><br><span class="line">B. float goto _A</span><br><span class="line">C. b-a goto int</span><br><span class="line">D. _123 temp INT</span><br><span class="line">我的答案: C正确答案: C</span><br><span class="line"></span><br><span class="line">//c语言表示符</span><br><span class="line">C 标识符是用来标识变量、函数，或任何其他用户自定义项目的名称</span><br><span class="line">一个标识符以字母 A-Z 或 a-z 或下划线 _ 开始，后跟零个或多个字母、下划线和数字（0-9）</span><br><span class="line">C 标识符内不允许出现标点字符，比如 @、$ 和 % -</span><br><span class="line">C 是区分大小写的编程语言。因此，在 C 中，a 和 A 是两个不同的标识符</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">在C语言中,数字029是一个_______。</span><br><span class="line">A. 八进制数</span><br><span class="line">B. 十六进制数</span><br><span class="line">C. 十进制数</span><br><span class="line">D. 非法数</span><br><span class="line">我的答案: A正确答案: D</span><br><span class="line"></span><br><span class="line">//见上面总结</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">合法的c语言字符常量是_____。</span><br><span class="line">A. &quot;T&quot;</span><br><span class="line">B. 39</span><br><span class="line">C. T</span><br><span class="line">D. &#x27;\n&#x27;   //转义字符</span><br><span class="line">我的答案: B正确答案: D</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">下面正确的字符常量是______。</span><br><span class="line">A. &#x27;\X17&#x27;</span><br><span class="line">B. &#x27;\80&#x27;</span><br><span class="line">C. &#x27;\\&#x27;</span><br><span class="line">D. &quot;\n&quot;</span><br><span class="line">我的答案: B正确答案: C</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">下列程序的输出为______。</span><br><span class="line">#include&lt;stdio.h&gt;</span><br><span class="line">void main()</span><br><span class="line">&#123; int m=13;</span><br><span class="line">float a=12.6, x;</span><br><span class="line">x=m/2+a/2;</span><br><span class="line">printf(“%f\n”, x);</span><br><span class="line">&#125;</span><br><span class="line">A. 12.000000</span><br><span class="line">B. 12.300000</span><br><span class="line">C. 12.800000</span><br><span class="line">D. 12.3</span><br><span class="line">我的答案: C正确答案: B</span><br><span class="line"></span><br><span class="line">//6 + 6.300000 = 12.300000</span><br><span class="line">//整数整除为整数，浮点整除为浮点</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">若以下变量均是整型,且num=sum=7;则计算表达式sum=num++, sum++, ++num后的sum值为 ________。</span><br><span class="line">A. 7</span><br><span class="line">B. 8</span><br><span class="line">C. 9</span><br><span class="line">D. 10</span><br><span class="line">我的答案: C正确答案: B</span><br><span class="line"></span><br><span class="line">// sum:8,num:9</span><br><span class="line">// sum++表示整个语句结束后自增1</span><br><span class="line">// ++sum表示先自增1再将这个值代入语句进行接下来的运算</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">假设所有变量均为整型,则表达式(a=2,b=5,b++,a+b)的值是 ________。</span><br><span class="line">A. 7</span><br><span class="line">B. 8</span><br><span class="line">C. 6</span><br><span class="line">D. 2</span><br><span class="line">我的答案: B正确答案: B</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">设c1. c2均是char类型变量,则以下不正确的函数调用为______。</span><br><span class="line">A. scanf(&quot;%c&quot;,c1)</span><br><span class="line">B. getchar(c2)</span><br><span class="line">C. putchar(c2)</span><br><span class="line">D. putchar(c1,c2)</span><br><span class="line">我的答案: A 正确答案: AD</span><br><span class="line"></span><br><span class="line">//puchar()只能是一个</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">设ch是char类型变量,其值是A,则表达式ch=(ch&gt;=&#x27;A&#x27;&amp;&amp;ch&lt;=&#x27;Z&#x27;)?(ch+32):ch的值是_______。</span><br><span class="line">A. Z</span><br><span class="line">B. A</span><br><span class="line">C. a</span><br><span class="line">D. z</span><br><span class="line">我的答案: A正确答案: C</span><br><span class="line"></span><br><span class="line">// ch+25 == &#x27;Z&#x27;</span><br><span class="line">// ch+36 变小写</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">若i和k都是int类型变量，有以下for语句for(i=O;k=-1;k=1;k+t) printf(&quot;*****\n&quot;);</span><br><span class="line">下面关于语句执行情况的叙述中正确的是___。</span><br><span class="line">A.循环体执行两次</span><br><span class="line">B.循环体执行一次</span><br><span class="line">C.循环体一次也不执行</span><br><span class="line">D.构成无限循环</span><br><span class="line"></span><br><span class="line">我的答案: C正确答案: D</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">以下合法的转义字符是__。</span><br><span class="line">A.&#x27;\x41&#x27;</span><br><span class="line">B.&#x27;\0x41&#x27;</span><br><span class="line">C.&#x27;\X41&#x27;</span><br><span class="line">D.‘\0X41&#x27;</span><br><span class="line">我的答案：B  标准答案:A</span><br><span class="line"></span><br><span class="line">//转义字符，反斜杠后的十六进制数只可以由小写字母x开头，不允许大写字母x，也不允许用ox开头</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">若有定义语句:int a=3,b=2,c=1;，以下选项中错误的赋值表达式是_。</span><br><span class="line">A.a=(b=4)=3;</span><br><span class="line"></span><br><span class="line">B.a=b=c+1;</span><br><span class="line">C.a=(b=4)+c;</span><br><span class="line">D.a=1+(b=c=4);</span><br><span class="line">我的答案：D 标准答案:A</span><br><span class="line"></span><br><span class="line">//表达式的形式为:变量名=表达式，赋值号的左边必须是一个代表某一存储单元的变量名，由于选项A相当于a=(b=4)和(b=4)=3两个健值表达式，且由于(b=4)=3运算符左边b=4不是变量，而是表达式，所以选项A不正确.</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">float fun(int x,int y) &#123;</span><br><span class="line">	return x+y; </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">int main()&#123;</span><br><span class="line">	int a=2,b=5,c=8;</span><br><span class="line">	printf(&quot;%3.0f&quot;,fun((int)fun(a+c,b),a-c));</span><br><span class="line">	</span><br><span class="line">	return 0;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">//答案：9</span><br><span class="line">//注意：%3.0与%3的区别，%3.0没有有小数</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">有如下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">mai()&#123;</span><br><span class="line">int a=0, b=1;</span><br><span class="line">if(a++&amp;&amp; b++)printf(&quot;T&quot;);</span><br><span class="line">else printf(&quot;&quot;F&quot;);</span><br><span class="line">printf(&quot; a=%d,b=%dn&quot;, a, b);&#125;</span><br><span class="line">程序运行后的输出结果是__。</span><br><span class="line">A.Ta=0,b=1</span><br><span class="line">B.Fa=0,b=2</span><br><span class="line">C.Ta=1,b=2</span><br><span class="line">D.Fa=1,b=1</span><br><span class="line">我的答案：C 正确答案：D</span><br><span class="line">//a++ &amp; b+-语句中，若是&amp;&amp;左边的表达式为假，则不必执行&amp;a右边的表达式，a++是先取值，后自加，取的值为b0，整个表达式为假，执行printf(&quot;F&quot;)</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">有下列程序</span><br><span class="line">#include &lt;stdio.h&gt;main()&#123;</span><br><span class="line">int a=0,b=0,c=0;</span><br><span class="line">if(++a || ++b &amp;&amp; ++c)</span><br><span class="line">printf (&quot;%d,%d,%d&quot;,a,b,c);</span><br><span class="line">&#125;</span><br><span class="line">程序执行后的输出结果是___。</span><br><span class="line">A.1,0,0</span><br><span class="line">B.1,1,1</span><br><span class="line">C.0,1,1</span><br><span class="line">D.1,1,0</span><br><span class="line">我的答案：B 正确答案：A</span><br><span class="line"></span><br><span class="line">//++a是先自增再执行表达式，执行表达式时使用的是自增后的，所以a的值为1。逻辑运算符或(||)左侧的表达式已经为真，所以右侧表达式不运行，b和c的值都为0。</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">(单选题)有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#define PT 3.5;</span><br><span class="line">#define S(x) PT*x*x;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int a=1,b=2;</span><br><span class="line">printf(&quot;%4.1f\n&quot;,S(a+b));</span><br><span class="line">&#125;</span><br><span class="line">程序运行后的输出结果是______。</span><br><span class="line">A. 14.0</span><br><span class="line">B. 31.5</span><br><span class="line">C. 7.5</span><br><span class="line">D. 程序有错无输出结果</span><br><span class="line">我的答案: C正确答案: D</span><br><span class="line"></span><br><span class="line">// #define PT 3.5;  没有;</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">(单选题)有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#define SUB(a)(a)-(a)</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int a=2,b=3,c=5,d;</span><br><span class="line">d=SUB(a+b)*c;</span><br><span class="line">printf(&quot;%d\n&quot;,d);</span><br><span class="line">&#125;</span><br><span class="line">程序运行后的输出结果是______。</span><br><span class="line">A. 0</span><br><span class="line">B. -12</span><br><span class="line">C. -20</span><br><span class="line">D. 10</span><br><span class="line">我的答案: A正确答案: C</span><br><span class="line"></span><br><span class="line">//(2+3)-(2+3)*5 = -20</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">(单选题)有如下程序</span><br><span class="line">#define N 2</span><br><span class="line">#define M N+1</span><br><span class="line">#define NUM 2*M+1</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int i;</span><br><span class="line">for(i=1;i&lt;=NUM;i++)</span><br><span class="line">printf(&quot;%d\n&quot;,i);</span><br><span class="line">&#125;</span><br><span class="line">该程序中的for循环执行的次数是______。</span><br><span class="line">A. 5</span><br><span class="line">B. 6</span><br><span class="line">C. 7</span><br><span class="line">D. 8</span><br><span class="line">我的答案: B正确答案: B</span><br><span class="line"></span><br><span class="line">// num:2*2+1+1 = 6</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(单选题)以下关于宏的叙述中正确的是______。</span><br><span class="line">A. 宏名必须用大写字母表示</span><br><span class="line">B. 宏定义必须位于源程序中所有语句之前</span><br><span class="line">C. 宏替换没有数据类型限制</span><br><span class="line">D. 宏调用比函数调用耗费时间</span><br><span class="line">我的答案: C正确答案: C</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">(单选题)下面选项中关于编译预处理的叙述正确的是______。</span><br><span class="line">A. 凡是以#号开头的行,都被称为编译预处理命令行</span><br><span class="line">B. 预处理命令行必须使用分号结尾</span><br><span class="line">C. 预处理命令行不能出现在程序的最后一行</span><br><span class="line">D. 预处理命令行的作用域是到最近的函数结束处</span><br><span class="line">我的答案: C正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">sizeof(double)是______。</span><br><span class="line">A. 一个双精度型表达式</span><br><span class="line">B. 一个整型表达式</span><br><span class="line">C. 一个不合法的表达式</span><br><span class="line">D. 一种函数调用</span><br><span class="line">我的答案: D正确答案: B</span><br><span class="line"></span><br><span class="line">//sizeof(double)是指求double类型数据的数据长度,是个整数</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">main()</span><br><span class="line">&#123; char a[20],b[20],c[20];</span><br><span class="line">scanf(&quot;%s%s&quot;,a,b);</span><br><span class="line">gets(c);</span><br><span class="line">printf(&quot;%s%s%s\n&quot;,a,b,c);&#125;</span><br><span class="line">程序运行时从第一列开始输入:This is a cat!&lt;回车&gt;</span><br><span class="line">则输出结果是</span><br><span class="line">A.Thisisacat!</span><br><span class="line">B.Thisis a</span><br><span class="line">C.Thisis a cat!</span><br><span class="line">D.Thisisa cat!</span><br><span class="line">我的答案：D 正确答案：C</span><br><span class="line"></span><br><span class="line">//空格留在缓存区了gets后被输入</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">以下选项中，与n=i++完全等价的表达式是</span><br><span class="line">A.n=i,i=i+1</span><br><span class="line">B.n+=i+1</span><br><span class="line">C.i=i+1,n=i</span><br><span class="line">D.n=++i</span><br><span class="line">我的答案：C 正确答案：A</span><br><span class="line"></span><br><span class="line">//先参与计算再相加</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;string.h&gt;</span><br><span class="line">main()</span><br><span class="line">&#123; char x[]=&quot;STRING&quot;;</span><br><span class="line">x[0]=0; x[1]=&#x27;\O&#x27;’;x[2]=0;</span><br><span class="line">printf(&quot;%d %d\n&quot;,sizeof(x),strlen(x));&#125;</span><br><span class="line">程序运行后的输出结果是</span><br><span class="line">A.6 1</span><br><span class="line">B.7 0</span><br><span class="line">c.6 3</span><br><span class="line">D.7 1</span><br><span class="line">我的答案：D 正确答案：B</span><br><span class="line"></span><br><span class="line">//&#x27;\0&#x27;的ascall值为0，所以第一个元素就是结束符0.0</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">以下程序段的输出结果是:</span><br><span class="line">char s[]=&quot;\\141\141abc\t&quot;;</span><br><span class="line">printf(&quot;%d\n&quot;,strlen(s));</span><br><span class="line">A.9</span><br><span class="line">B.12</span><br><span class="line">C.13</span><br><span class="line">D.14</span><br><span class="line">我的答案：B 正确答案：A</span><br><span class="line"></span><br><span class="line">//  \\ 1 4 1 \141 a b c \t 共9个</span><br><span class="line">\+字母：控制字符</span><br><span class="line">\+1~3个八进制数：ascll该八进制数的字符</span><br><span class="line">\x+1~2个十六进制数：ascll为改十六进制数的字符</span><br></pre></td></tr></table></figure>

<h3 id="结构体"><a href="#结构体" class="headerlink" title="结构体"></a>结构体</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">(单选题)若有下面的说明和定义,则sizeof(struct aa)的值是______。</span><br><span class="line">struct aa</span><br><span class="line">&#123; int r1;</span><br><span class="line">double r2;</span><br><span class="line">float r3;</span><br><span class="line">union uu</span><br><span class="line">&#123; char u1[5];</span><br><span class="line">long u2[2];</span><br><span class="line">&#125;ua;</span><br><span class="line">&#125;maya;</span><br><span class="line">A. 30</span><br><span class="line">B. 29</span><br><span class="line">C. 24</span><br><span class="line">D. 22</span><br><span class="line">我的答案: C正确答案: D</span><br><span class="line"></span><br><span class="line">//这题不会啊，</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line">以下程序的输出结果是</span><br><span class="line">main()</span><br><span class="line">&#123;union &#123;</span><br><span class="line"> char i[2];int k;&#125;r; </span><br><span class="line">r.i[0]=2;</span><br><span class="line">r.i[1]=0;</span><br><span class="line">printf(&quot;%d\n&quot;,r.k);&#125;</span><br><span class="line">A.2</span><br><span class="line">B.1</span><br><span class="line">C.0</span><br><span class="line">D.不确定</span><br><span class="line">我的答案：D 正确答案：A</span><br><span class="line"></span><br><span class="line">//共用体共用一块存储空间，2的二进制:00000010,0的二进制就为0，最后的地址就为000000010，这题不明显，看下面</span><br><span class="line"></span><br><span class="line">main()</span><br><span class="line">&#123;union &#123;</span><br><span class="line"> char i[2];int k;&#125;r; </span><br><span class="line">r.i[0]=1;</span><br><span class="line">r.i[1]=2;</span><br><span class="line">printf(&quot;%d\n&quot;,r.k);&#125;  513</span><br><span class="line"></span><br><span class="line">//0000000100000010 前八位位1的二进制，后八位为2的二进制</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">main()</span><br><span class="line">&#123;union &#123;</span><br><span class="line"> char i[2];int k;&#125;r; </span><br><span class="line">r.i[0]=2;</span><br><span class="line">r.i[1]=1;</span><br><span class="line">printf(&quot;%d\n&quot;,r.k);&#125; 258</span><br><span class="line"></span><br><span class="line">//0000001000000001 前八位位2的二进制，后八位为1的二进制</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">int fun(int x[].int n)</span><br><span class="line">&#123;static int sum=o, i;</span><br><span class="line">for(i=0;i&lt;n;i++) sum+=x[i];</span><br><span class="line">return sum;&#125;</span><br><span class="line">main()</span><br><span class="line">int a[]=&#123;1.2,3,4,53,b[]=&#123;6,7,8,9&#125;, s=O;</span><br><span class="line">s=fun(a,5)+fun(b,4);</span><br><span class="line">printf(&quot;%din&quot;.s);</span><br><span class="line">&#125;</span><br><span class="line">程序执行后的输出结果是()</span><br><span class="line">A.55</span><br><span class="line">B.50</span><br><span class="line">C.45</span><br><span class="line">D.60</span><br><span class="line"></span><br><span class="line">我的答案：C 正确答案：D</span><br><span class="line"></span><br><span class="line">//static作用：在函数调用结束不会释放内存，支部会变为0</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">若有以下语句:</span><br><span class="line">typedef struct S</span><br><span class="line">&#123;</span><br><span class="line">int g;</span><br><span class="line">char h;</span><br><span class="line">&#125;T;</span><br><span class="line">以下叙述中正确的是______。</span><br><span class="line">A. 可用S定义结构体变量</span><br><span class="line">B. 可用T定义结构体变量</span><br><span class="line">C. S是struct类型的变量</span><br><span class="line">D. T是struct S类型的变量</span><br><span class="line">我的答案: C正确答案: B</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">设有如下语句</span><br><span class="line">typedef struct Date&#123;</span><br><span class="line">int year;</span><br><span class="line">int month;</span><br><span class="line">int day;&#125;DATE;</span><br><span class="line">则以下叙述中错误的是()</span><br><span class="line">A.DATE是用户定义的结构体变量</span><br><span class="line">B.struct Date是用户定义的结构体类型</span><br><span class="line">C.DATE是用户说明的新结构体类型名</span><br><span class="line">D.struct是结构体类型的关键字</span><br><span class="line">我的答案：C 正确答案：A</span><br><span class="line"></span><br><span class="line">//struct 结构体名&#123;成员列表&#125;变量列表;</span><br><span class="line">typedef 类型名 标识符；</span><br><span class="line">#define N 10000 这里没有;</span><br><span class="line">此处DETA为该结构体的标识符,所以是结构体名</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">以下结构体类型说明和变量定义中正确的是</span><br><span class="line">A.typedef struct</span><br><span class="line">&#123;int ngchar c;&#125; REC;REC t1,t2;</span><br><span class="line">B.struct REC&#123;int n;char c;&#125;;REC t1,t2;</span><br><span class="line">C.typedef struct REC;</span><br><span class="line">&#123;int n=O;char c= &#x27;A&#x27;;&#125;t1,t2;</span><br><span class="line">D.struct</span><br><span class="line">&#123;int n;char c;&#125; REC; REC t1,t2;</span><br><span class="line">我的答案：B 正确答案：A</span><br><span class="line"></span><br><span class="line">//B：struct REC t1,t2;(少了struct)</span><br><span class="line">struct 结构体名&#123;&#125;变量名;</span><br><span class="line">struct &#123;&#125;变量名;</span><br><span class="line">struct 结构体名&#123;&#125;; struct 结构体名 变量名;</span><br></pre></td></tr></table></figure>

<h3 id="函数"><a href="#函数" class="headerlink" title="函数"></a>函数</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">关于函数返回值，正确的是（）</span><br><span class="line">A.函数不能没有返回值</span><br><span class="line">B.函数可以返回一个数组</span><br><span class="line">C.函数只能返回基本数据类型或指针</span><br><span class="line">D.函数可以返回整个结构体，即使结构体中有数组</span><br><span class="line">我的答案：C 正确答案：D</span><br><span class="line"></span><br><span class="line">//数组类型和函数类型不能做返回值</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">以下选项中叙述错误的是_</span><br><span class="line">A.C程序函数中定义的赋有初值的静态变量，每调用一次函数，赋一次初值</span><br><span class="line">B.在c程序的同一函数中，各复合语句内可以定义变量，其作用域仅限本复合语句内</span><br><span class="line">C.C程序函数中定义的自动变量，系统不自动赋确定的初值</span><br><span class="line">D.C程序函数的形参不可以说明为static型变量</span><br><span class="line">我的答案：D 正确答案：A</span><br><span class="line"></span><br><span class="line">//静态局部变量，对其只赋一次初值，以后每次调用函数对不再重新赋初值，而只是保留上次函数调用结束时的值。对anto变量来说，如果不赋初值则它的值是一个不确定的值。因此选项A错误。</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">认下叙述中正确的是_</span><br><span class="line">A.全局变量的存储类别可以是静态类</span><br><span class="line">B.对于变量而言,&quot;定义&quot;和&quot;说明&quot;这两个词实际上是同一个意思</span><br><span class="line">C.在复合语句中不能定义变量</span><br><span class="line">D.函数的形式参数不属于局部变量</span><br><span class="line">我的答案：C 标准答案:A</span><br><span class="line"></span><br><span class="line">//A.全局变量是在所有作用域都可访问的变量，它可以是静态的</span><br><span class="line">//B.对于变量而言，&quot;定义&quot;是指给变量分配确定的存储单元。&quot;说明&quot;只是说明变量的性层在复合语句内部定义的变量称为局部变量</span><br><span class="line">//C.复合语句：类似与函数（许多语句组成）</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">下列叙述中正确的是</span><br><span class="line">A.每一个c程序文件中都必须要有一个main()函数</span><br><span class="line">B.在C程序中main()函数的位置是固定的</span><br><span class="line">C.C程序中所有函数之间都可以相互调用，与函数所在位置无关</span><br><span class="line">D.在C程序的函数中不能定义另一个函数</span><br><span class="line">我的答案：A  正确答案：D</span><br><span class="line"></span><br><span class="line">//c程序文件中含有多个c程序，每个c程序必须要有main()函数，A错。</span><br><span class="line">//B：不是固定的  C:无法调用main()函数</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">以下叙述中正确的是</span><br><span class="line">A.构成c程序的基本单位是函数</span><br><span class="line">B.可以在一个函数中定义另一个函数</span><br><span class="line">C.main()函数必须放在其它函数之前</span><br><span class="line">D.所有被调用的函数一定要在调用之前进行定义</span><br><span class="line">我的答案：D 正确答案：A</span><br><span class="line"></span><br><span class="line">//D:若函数放在main函数之后则需要定义，否则不需要定义</span><br></pre></td></tr></table></figure>

<h3 id="文件"><a href="#文件" class="headerlink" title="文件"></a>文件</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">以下叙述正确的是()</span><br><span class="line">A.表达式sizeof(FILE*)== sizeof(int*)的值为真</span><br><span class="line">B.文件指针的值是一个整数,它的值一定小于文件字节数</span><br><span class="line">C.文件指针的值是所指文件的当前读取位置</span><br><span class="line">D.使用fscanf函数可以向任意类型的文件中写入任意数量的字符</span><br><span class="line"></span><br><span class="line">我的答案：C 正确答案：A</span><br><span class="line">//文件指针实际上是指向一个结构体类型的指针，这个结构体包含有诸如:缓冲区的地址、在缓冲区中当前存取的字符的位置、对文件&quot;读&quot;还是&quot;写&quot;、是否出错，是否已经遇到文件结束标志等信息，并不是单单只是所指向文件位置，而是指向的一块空间内存</span><br><span class="line">fscanf是从文件中格式化读取，fprintf才是向文件中格式化写入</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">(单选题)有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;string.h&gt;</span><br><span class="line">#include &lt;stdlib.h&gt;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">char *p1,*p2;</span><br><span class="line">p1=p2=(char *)malloc(sizeof(char)*10);</span><br><span class="line">strcpy(p1,&quot;malloc&quot;);</span><br><span class="line">strcpy(p2,p1+1);</span><br><span class="line">printf(&quot;%c%c\n&quot;,p1[0],p2[0]);</span><br><span class="line">&#125;</span><br><span class="line">程序的运行结果是______。</span><br><span class="line">A. aa</span><br><span class="line">B. ma</span><br><span class="line">C. am</span><br><span class="line">D. mm</span><br><span class="line">我的答案: B正确答案: A</span><br><span class="line"></span><br><span class="line">// p1和p2指向同一空间</span><br><span class="line">第一个strcpy: 一开始为 malloc</span><br><span class="line">第二个strcpy:  变为 alloc</span><br><span class="line">这是两个都指向这个alloc</span><br><span class="line">输出则为aa </span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">(单选题)有以下程序</span><br><span class="line">#include &lt;stdio.h&gt;</span><br><span class="line">#include &lt;stdlib.h&gt;</span><br><span class="line">main()</span><br><span class="line">&#123;</span><br><span class="line">int *a,*b,*c;</span><br><span class="line">a=b=c=(int *)malloc(sizeof(int));</span><br><span class="line">*a=1;</span><br><span class="line">*b=2,*c=3;</span><br><span class="line">a=b;</span><br><span class="line">printf(&quot;%d,%d,%d\n&quot;,*a,*b,*c);</span><br><span class="line">&#125;</span><br><span class="line">程序运行后的输出结果是______。</span><br><span class="line">A. 3,3,3</span><br><span class="line">B. 2,2,3</span><br><span class="line">C. 1,2,3</span><br><span class="line">D. 1,1,3</span><br><span class="line">我的答案: B正确答案: A</span><br><span class="line"></span><br><span class="line">//a=b=c=(int *)malloc(sizeof(int));表示三个指向同一空间，有一个变化其余都变化</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">对于语句void *p=malloc(sizeof (int)*250);,下面说法正确的是______。</span><br><span class="line">A. 这条语句存在语法错误</span><br><span class="line">B. 利用指针p,所申请的内存可作为250个int元素的一维数组来使用</span><br><span class="line">C. 经强制类型转换后,该语句所申请的内存可以作为125个double元素的一维数组来使用</span><br><span class="line">D. 该语句所申请内存只能存储int数据</span><br><span class="line">我的答案: B正确答案: C</span><br><span class="line"></span><br><span class="line">//B需要通过强制类型转换！</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">设有定义和语句(假设short int型数据占2字节)</span><br><span class="line">short int *pi,*pj;</span><br><span class="line">pi=pj=(short *)malloc(2);</span><br><span class="line">则以下叙述正确的是______。</span><br><span class="line">A. pi和pj指向了同一个short int型存储单元</span><br><span class="line">B. pi和pj指向了2个连续的short int型存储单元的首地址</span><br><span class="line">C. pi和pj分别指向了一个short int型存储单元</span><br><span class="line">D. pi和pj分别指向了2个short int型存储单元</span><br><span class="line">我的答案: D正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">若指针p已正确定义,要使p指向两个连续的整型动态存储单元,不正确的语句是______。</span><br><span class="line">A. p=2*(int*)malloc(sizeof(int));</span><br><span class="line">B. p=(int*)malloc(2*sizeof(int))</span><br><span class="line">C. p=(int*)malloc(2*2) //int为2？？</span><br><span class="line">D. p=(int*)calloc(2,sizeof(int))</span><br><span class="line">我的答案: B正确答案: A</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">标准库函数fgets( s,n,f )的功能是（）</span><br><span class="line">A.从文件f中读取长度不超过n-1的字符串存入指针s所指的内存</span><br><span class="line">B.从文件f中读取长度为n的字符串存入指针s所指的内存</span><br><span class="line">C.从文件f中读取n个字符串存入指针s所指的内存</span><br><span class="line">D.从文件f中读取n-1个字符串存入指针s所指的内存</span><br><span class="line">我的答案：B 正确答案：A</span><br><span class="line"></span><br><span class="line">//fgets(str,n,fp)：从fp指向的文件读入一个长度为(n-1)的字符串放到字符数组str中，成功返回地址，否则返回NULL</span><br><span class="line">补充：</span><br><span class="line">fputs(str,fp)：写</span><br><span class="line">fgetc(fp)：读</span><br><span class="line">fputc(str,fp)：写</span><br><span class="line">fopen(&quot;a.txt&quot;,&quot;r&quot;)：打开，见下面</span><br><span class="line">fclose(fp)：关闭</span><br><span class="line">fprintf(fp,&quot;%d&quot;,a)：读，从fp中读a</span><br><span class="line">fscanf(fp,&quot;%d&quot;,&amp;a)：写，把a写入fp中</span><br><span class="line">fread(存储区地址,size,count,fp)：读，size字节数，count：数据项</span><br><span class="line">fwrite(储存区地址,size,count,fp)：写</span><br><span class="line">feof(fp)：判断是否到达文件尾部标准</span><br><span class="line">rewind(fp)：使文件指向指向开头</span><br><span class="line">fseek(fp,100L,0)：0-开始位置，1-当前位置，2-末尾；100L-位移量</span><br><span class="line"></span><br><span class="line">r：只读     r+：读和写</span><br><span class="line">w：只写     w+：读和写</span><br><span class="line">a：只追加   a+：追加并从头开读</span><br></pre></td></tr></table></figure>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="http://www.lijunxi.site">Jixer</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="http://www.lijunxi.site/posts/3014530432/">http://www.lijunxi.site/posts/3014530432/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://www.lijunxi.site" target="_blank">Jixer的小屋</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/C%E8%AF%AD%E8%A8%80/">C语言</a></div><div class="post_share"><div class="social-share" data-image="https://q1.qlogo.cn/g?b=qq&amp;nk=2770063826&amp;s=640" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="/pluginsSrc/butterfly-extsrc/sharejs/dist/css/share.min.css?v=1.1.3" media="print" onload="this.media='all'"><script src="/pluginsSrc/butterfly-extsrc/sharejs/dist/js/social-share.min.js?v=1.1.3" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/669583838/" title="Java错题集"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Java错题集</div></div></a></div><div class="next-post pull-right"><a href="/posts/695896537/" title="Python学习笔记"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Python学习笔记</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/3447396109/" title="C语言指针"><div class="cover" style="background: var(--default-bg-color)"></div><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-01-17</div><div class="title">C语言指针</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="" data-original="https://q1.qlogo.cn/g?b=qq&amp;nk=2770063826&amp;s=640" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Jixer</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">52</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">19</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">7</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/2770063826"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content"></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%80%BB%E7%BB%93"><span class="toc-text">总结</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%8D%E8%BF%90%E7%AE%97"><span class="toc-text">位运算</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8C%87%E9%92%88"><span class="toc-text">指针</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%95%B0%E7%BB%84"><span class="toc-text">数组</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%8D%E4%BA%94%E7%AB%A0%E5%9F%BA%E7%A1%80%E9%A2%98"><span class="toc-text">前五章基础题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%BB%93%E6%9E%84%E4%BD%93"><span class="toc-text">结构体</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%87%BD%E6%95%B0"><span class="toc-text">函数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6"><span class="toc-text">文件</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/posts/2029624507/" title="2022年算法队选拔赛">2022年算法队选拔赛</a><time datetime="2024-05-09T15:00:27.000Z" title="发表于 2024-05-09 23:00:27">2024-05-09</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/posts/1978524057/" title="牛客小白月赛84">牛客小白月赛84</a><time datetime="2024-05-08T14:40:35.000Z" title="发表于 2024-05-08 22:40:35">2024-05-08</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/posts/131339317/" title="软件测试资料">软件测试资料</a><time datetime="2024-05-07T03:12:52.000Z" title="发表于 2024-05-07 11:12:52">2024-05-07</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/posts/2394234105/" title="第十四届蓝桥杯B组国赛">第十四届蓝桥杯B组国赛</a><time datetime="2024-05-05T13:40:15.000Z" title="发表于 2024-05-05 21:40:15">2024-05-05</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/posts/1405472621/" title="Leetcode第396场周赛">Leetcode第396场周赛</a><time datetime="2024-05-05T03:58:25.000Z" title="发表于 2024-05-05 11:58:25">2024-05-05</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2024 By Jixer</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="https://beian.miit.gov.cn/#/Integrated/index" style="color:white" target="_blank">蜀ICP备2022009955号-1</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js?v=4.13.0"></script><script src="/js/main.js?v=4.13.0"></script><script src="/pluginsSrc/@fancyapps/ui/dist/fancybox/fancybox.umd.js?v=5.0.33"></script><div class="js-pjax"></div><script src="/js/custom-fancybox-umd-min.js"></script><script src="/js/custom-busuanzi-pure-mini.js"></script><script src="/js/Valine.min.js"></script><script src="/js/custom-social-share.min.js"></script><script src="/js/custom-typed-umd-min.js"></script><script src="/js/av-min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js?v=4.13.0"></script></div></div>
        <style>
            [bg-lazy] {
                background-image: none !important;
                background-color: #eee !important;
            }
        </style>
        <script>
            window.imageLazyLoadSetting = {
                isSPA: false,
                preloadRatio: 1,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(r){r.imageLazyLoadSetting.processImages=t;var e=r.imageLazyLoadSetting.isSPA,n=r.imageLazyLoadSetting.preloadRatio||1,c=a();function a(){var t=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")),e=Array.prototype.slice.call(document.querySelectorAll("[bg-lazy]"));return t.concat(e)}function t(){e&&(c=a());for(var t,o=0;o<c.length;o++)0<=(t=(t=c[o]).getBoundingClientRect()).bottom&&0<=t.left&&t.top<=(r.innerHeight*n||document.documentElement.clientHeight*n)&&function(){var t,e,n,a,i=c[o];e=function(){c=c.filter(function(t){return i!==t}),r.imageLazyLoadSetting.onImageLoaded&&r.imageLazyLoadSetting.onImageLoaded(i)},(t=i).hasAttribute("bg-lazy")?(t.removeAttribute("bg-lazy"),e&&e()):(n=new Image,a=t.getAttribute("data-original"),n.onload=function(){t.src=a,t.removeAttribute("data-original"),e&&e()},t.src!==a&&(n.src=a))}()}function i(){clearTimeout(t.tId),t.tId=setTimeout(t,500)}t(),document.addEventListener("scroll",i),r.addEventListener("resize",i),r.addEventListener("orientationchange",i)}(this);</script></body></html>